<template>
  <span class="flex-center gap-x-1">
    <!-- 检测中 -->
    <section v-if="loading" class="flex-center gap-x-6px">
      <i-icons-applying class="rotate-infinite" />
      检测中
    </section>
    <section v-if="!loading" class="flex-center gap-x-6px">
      <i-icons-success v-if="status === A_RESOLVE_TYPE.RESOLVED" />
      <i-icons-warning v-else />
      {{ getOptionsLabel(resolveStatusOptions, status) }}
    </section>
    <i-icons-refresh
      v-if="!loading"
      class="table-icon"
      @click.stop="emit('refresh')" />
  </span>
</template>
<script lang="ts" setup>
import { A_RESOLVE_TYPE, resolveStatusOptions } from '@/constants'
import { getOptionsLabel } from '@/utils'
interface IProps {
  status: number
  loading: boolean
}
withDefaults(defineProps<IProps>(), {
  loading: false
})
interface IEmits {
  (event: 'update:status', value: number): void
  (event: 'update:loading', value: boolean): void
  (event: 'refresh'): void
}
const emit = defineEmits<IEmits>()
</script>

<style lang="less" scoped></style>
